#include "src/aot-compiler/aot.h"

#include "src/api/api-inl.h"
#include "src/ir/translator.h"

namespace portable {

bool enable_copyable{true};
bool enable_log{false};

uintptr_t AOT::precompile_with_ir_new_be(v8::Isolate* isolate,
                                         v8::Local<v8::String> source,
                                         std::vector<uint8_t>* pbc_buffer,
                                         bool debug, bool block_scope) {
  enable_log = debug;
  v8::internal::Isolate* i_isolate =
      reinterpret_cast<v8::internal::Isolate*>(isolate);
  v8::internal::Handle<v8::internal::String> str =
      v8::Utils::OpenHandle(*(source));
  return v8::aot::ProduceHBCModuleWithIRNewBE(i_isolate, str, pbc_buffer,
                                              block_scope, enable_log);
}
}  // namespace portable